﻿using System;
using System.Collections.Generic;
using ProjScan.Tools;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;

namespace ProjScan.ScanGUI.Tools
{
	// Token: 0x0200025C RID: 604
	public class FailedDataColumnHeader : MultiColumnHeader
	{
		// Token: 0x0600105F RID: 4191 RVA: 0x00007E59 File Offset: 0x00006059
		public FailedDataColumnHeader(MultiColumnHeaderState state, string ruleID) : base(state)
		{
			this.string_0 = string.Empty;
			this.rect_0 = default(Rect);
			this.rect_1 = default(Rect);
			this.string_0 = ruleID;
		}

		// Token: 0x06001060 RID: 4192 RVA: 0x0004A360 File Offset: 0x00048560
		protected void AdjustColumnLayOut(Rect columnRect)
		{
			float x = columnRect.x;
			float width = columnRect.width;
			float y = columnRect.y;
			this.rect_0 = columnRect;
			this.rect_0.x = x + width - 20f;
			this.rect_0.width = 20f;
			this.rect_0.y = y + 3f;
			this.rect_1 = columnRect;
			this.rect_1.width = width - 20f;
		}

		// Token: 0x06001061 RID: 4193 RVA: 0x0004A3E0 File Offset: 0x000485E0
		protected override void ColumnHeaderGUI(MultiColumnHeaderState.Column column, Rect headerRect, int columnIndex)
		{
			bool flag = ((FailedDataHeaderColumn)column).type == FailedDataHeaderColumn.ColumnType.shouldBeFixed;
			if (flag)
			{
				this.AdjustColumnLayOut(headerRect);
				base.ColumnHeaderGUI(column, this.rect_1, columnIndex);
				this.DrawCheckAllToogle(this.rect_0, this.string_0);
			}
			else
			{
				base.ColumnHeaderGUI(column, headerRect, columnIndex);
			}
		}

		// Token: 0x06001062 RID: 4194 RVA: 0x0004A43C File Offset: 0x0004863C
		protected void DrawCheckAllToogle(Rect rect, string ruleID)
		{
			bool flag = FailedResultManager.Instance.dicFails.ContainsKey(ruleID);
			if (flag)
			{
				GUIStyle tstyle = Singleton<GUIStyleManager>.Instance.GetTStyle(TStyle.CheckBox);
				Dictionary<string, FailedAssetInfo> dictionary = FailedResultManager.Instance.dicFails[ruleID];
				bool flag2 = dictionary != null && dictionary.Count != 0;
				if (flag2)
				{
					foreach (KeyValuePair<string, FailedAssetInfo> keyValuePair in dictionary)
					{
						string key = keyValuePair.Key;
						bool flag3 = !WhiteAssetManager.Instance.GetWhiteListForRuleId(ruleID).Contains(key) && !keyValuePair.Value.ShouldBeFixed;
						if (flag3)
						{
							this.bool_0 = false;
						}
					}
					bool flag4 = this.bool_0;
					this.bool_0 = EditorGUI.Toggle(rect, this.bool_0, tstyle);
					bool flag5 = flag4 != this.bool_0;
					if (flag5)
					{
						this.method_0(this.bool_0, ref dictionary);
					}
				}
			}
		}

		// Token: 0x06001063 RID: 4195 RVA: 0x0004A558 File Offset: 0x00048758
		private void method_0(bool bool_1, ref Dictionary<string, FailedAssetInfo> dictionary_0)
		{
			List<KeyValuePair<string, FailedAssetInfo>> list = new List<KeyValuePair<string, FailedAssetInfo>>();
			foreach (KeyValuePair<string, FailedAssetInfo> item in dictionary_0)
			{
				list.Add(item);
			}
			for (int i = 0; i < list.Count; i++)
			{
				KeyValuePair<string, FailedAssetInfo> keyValuePair = list[i];
				dictionary_0[keyValuePair.Key].ShouldBeFixed = bool_1;
			}
		}

		// Token: 0x040009A8 RID: 2472
		private string string_0;

		// Token: 0x040009A9 RID: 2473
		private bool bool_0;

		// Token: 0x040009AA RID: 2474
		private Rect rect_0;

		// Token: 0x040009AB RID: 2475
		private Rect rect_1;
	}
}
